<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<link href="<?=domain?>static/style/manage.css" rel="stylesheet" type="text/css" />
<link href="<?=domain?>static/style/fancybox.css" rel="stylesheet" type="text/css" />
<link href="<?=domain?>static/style/wysiwyg.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?=domain?>static/scripts/core.js" charset="utf-8"></script>
<script type="text/javascript" src="<?=domain?>static/scripts/fancybox.js" charset="utf-8"></script>
<script type="text/javascript" src="<?=domain?>static/scripts/wysiwyg.js" charset="utf-8"></script>
<script type="text/javascript" src="<?=domain?>static/scripts/manage.js" charset="utf-8"></script>
<title><?=name?></title>
<body>
<div class="boxtitle">添加内容</div>
<form name="append" method="post" action="<?=domain?>index.php?c=content&a=append" onsubmit="return RequestPost('append');">
<div class="area box" style="height:500px;">
	<div class="line limit">
		<div class="w m">一级目录</div>
		<div class="s h select" change="SelectSort">
			<a href="#"><label>请选择一级目录...</label><input type="hidden"><span></span></a>
	        <ul>
	          <?php
	          foreach($sort as $key=>$value){
	          ?>
		   	  <li tab="<?=$key?>"><a href="#"><?=$value['name']?></a></li>
			  <?php
			  }
	          ?>
		   	</ul>
		</div>
		<div class="e c"><font color="red">*</font>,分类目录.</div>
	</div>
	<div class="line limit">
		<div class="w m">二级目录</div>
		<div class="s h select" id="sort">
			<a href="#"><label>请选择二级目录...</label><input type="hidden" name="sort" value="0"/><span></span></a>
	        <ul>
		   	</ul>
		</div>
		<div class="e c"><font color="red">*</font>,分类目录.</div>
	</div>
	<div class="line limit">
		<div class="w m">标题</div>
		<div class="s h"><input type="text" name="title" value="" maxlength="32"/></div>
		<div class="e c"><font color="red">*</font>,内容标题</div>
	</div>
	<div class="line">
		<div class="w m">内容:</div>
	</div>
	<div class="line" style="height:260px;">
		<textarea name="detail" style="width:100%;height:100%"></textarea>
		<script language="JavaScript" type="text/javascript">
		$('textarea[name="detail"]').wysiwyg({
			maxHeight:'100%',brIE:false,controls:{html:{visible:true}},messages:{nonSelection:'请先选择你想链接的元素.'}
		});
		</script>
	</div>
	<div class="line limit" style="margin-top:42px;">
		<div class="w m">排序</div>
		<div class="s h"><input type="text" name="sequence" value="0" maxlength="3"/></div>
		<div class="e c"><font color="red">*</font>,排列位置.</div>
	</div>
</div>
<div class="boxbu">
	<input type="submit" name="save" value="确定" class="yellow"/>
</div>
</form>
</body>
</html>
<script language="JavaScript" type="text/javascript">
var sort=<?=json_encode($sort)?>;
function SelectSort(select){
	var obj=$('#sort');
	var select=$(select).attr('tab');
	if(obj.find('input[name="sort"]').attr('value')!='0'){
		obj.find('label').text('请选择二级目录...');
		obj.find('input').attr('value',0);
	}
	var html='';
	for(key in sort[select]['child']){
		html+='<li tab="'+sort[select]['child'][key]['id']+'"><a href="#">'+sort[select]['child'][key]['name']+'</a></li>';
	}
	obj.find('ul').addClass('limit').html(html);
	InitSelect('[id="sort"]');
}
</script>